package com.project.controller;

import com.project.service.IInventoryService;
import com.project.service.IProcureService;
import com.project.webOneService.IProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("Inventory")
public class InventoryController {
    @Autowired
    private IInventoryService iInventoryService;
    @Autowired
    private IProductService productService;

    /**
     * 修改待上架商品，上下架状态
     * @param id    商品编号
     * @param waitProductStatus 商品状态
     * @return "ok"
     */
    @RequestMapping("updateWaitProductStatus")
    public String updateWaitProductStatus(String id , Integer waitProductStatus){
       productService.updateProductStatus(waitProductStatus,id);
        iInventoryService.updateWaitProductStatus(id,waitProductStatus);
        return "ok";
    }

//    /** 在procure里面
//     * 监听库存的数量，小于阈值，或为0，则添加到采购申请中
//     * 注意：该方法需要前端一直
//     * @return  返回监听到结果
//     */
//    @RequestMapping("monitorInventory")
//    public String monitorInventory(){
////        return iInventoryService.monitorInventory();
//        return null;
//    }
}
